<?php
require("db_manage/dbFunctions.php");
/**
* This retrieves the a unique set of equipment names and return in a format
* that will easily populate an html dropdown menu.
*
* Author: John Gaffney
* Date: 11/24/12
**/

function resourcePopulate()
{
	$dbh = connectDB();
	$query = "SELECT DISTINCT equipment_name from Equipment";
	$stmt = $dbh->prepare($query);
	$stmt->execute();
	$results = $stmt->fetchAll(PDO::FETCH_ASSOC); 

	$return_string = "";

	$return_string .= "<option value=\"Rooms\">Rooms</option>\n";
	foreach($results as $eq)
	{
		$return_string .= "<option value=\"" . $eq['equipment_name'] . "\">" . $eq['equipment_name'] . "</option>\n";
	}

	$stmt = null;
	$dbh = null;
	return $return_string;
}

?>
